package com.freemalll.merchant.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.freemalll.common.core.annotation.ResultInterceptor;
import com.freemalll.merchant.domain.dto.coopManagement.AssetContrastQueryDto;
import com.freemalll.merchant.domain.dto.coopManagement.AssetLogPageDto;
import com.freemalll.merchant.domain.dto.coopManagement.AssetManageEditDto;
import com.freemalll.merchant.domain.dto.coopManagement.AssetManagePageDto;
import com.freemalll.merchant.domain.entity.coopManagement.MerAssetManage;
import com.freemalll.merchant.domain.vo.coopManagement.AssetManagePageVo;
import com.freemalll.merchant.domain.vo.coopManagement.AssetRateLogPageVo;
import com.freemalll.merchant.service.coopManagement.MerAssetLogService;
import com.freemalll.merchant.service.coopManagement.MerAssetManageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Tag(name = "合作管理：资方管理")
@RestController
@RequestMapping("/cooperative/asset-management")
@ResultInterceptor
@AllArgsConstructor
public class AssetManagementController {

    private final MerAssetManageService merAssetManageService;
    private final MerAssetLogService merAssetLogService;


    @PostMapping("/page")
    @Operation(summary = "分页")
    public Page<AssetManagePageVo> pageSearch(@RequestBody AssetManagePageDto dto) {
        return merAssetManageService.pageSearch(dto);
    }

    @GetMapping("/list")
    @Operation(summary = "列表")
    public List<MerAssetManage> listSearch() {
        return merAssetManageService.listSearch();
    }

    @PostMapping("/edit")
    @Operation(summary = "编辑")
    public void edit(@RequestBody AssetManageEditDto dto) {
        merAssetManageService.edit(dto);
    }

    @PostMapping("/operationLogPage")
    @Operation(summary = "操作日志分页")
    public Page<AssetRateLogPageVo> operationLogPage(@RequestBody AssetLogPageDto dto) {
        return merAssetLogService.operationLogPage(dto);
    }

    @GetMapping("/findOneById/{id}")
    @Operation(summary = "根据主键获取数据")
    public AssetManageEditDto findOneById(@PathVariable String id) {
        return merAssetManageService.findOneById(id);
    }

    @PostMapping("/comparisonOfCapital")
    @Operation(summary = "资方对比")
    public List<Map<String, Object>> comparisonOfCapital(@RequestBody AssetContrastQueryDto dto)  {
        return merAssetManageService.comparisonOfCapital(dto);
    }


}
